<html>
<head><meta charset="utf-8"><title>Termination and Display · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html">Termination and Display</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212836409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212836409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212836409">(Oct 09 2020 at 14:57)</a>:</h4>
<p>Based on the discussion in <a href="https://github.com/rust-lang/rust/issues/43301">https://github.com/rust-lang/rust/issues/43301</a>, it seems like the Termination::report implementations for Result&lt;_, T&gt; use Debug instead of Display for wider compatibility. However, Debug messages are (understandably) much less human-readable, especially with the proliferation of crates like thiserror that make it easy to create useful Display implementations. Would it be possible to change this in a non-breaking way?</p>



<a name="212836459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212836459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212836459">(Oct 09 2020 at 14:57)</a>:</h4>
<p>Of course, this couldn't be changed outright, but I wonder if it'd be possible to specialize on the Display trait or similar.</p>



<a name="212836804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212836804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212836804">(Oct 09 2020 at 15:00)</a>:</h4>
<p>compatibility? no, I'm pretty sure this is a design mistake</p>



<a name="212836888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212836888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212836888">(Oct 09 2020 at 15:01)</a>:</h4>
<p>Using specialization to fix this would unfortunately require more powerful specialization than we have today, so I don't think it's currently possible</p>



<a name="212836986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212836986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212836986">(Oct 09 2020 at 15:01)</a>:</h4>
<p>Well, for the return of main we could fix this with compiler magic, but yeah</p>



<a name="212837074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837074">(Oct 09 2020 at 15:02)</a>:</h4>
<p>True</p>



<a name="212837141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837141">(Oct 09 2020 at 15:03)</a>:</h4>
<p>Question is whether the lang team would sign off on that, I think not</p>



<a name="212837210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837210">(Oct 09 2020 at 15:03)</a>:</h4>
<p>I think it's not clear that debug/display <em>is</em> actually a design mistake, fwiw</p>



<a name="212837326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837326">(Oct 09 2020 at 15:04)</a>:</h4>
<p>like, certainly  for some cases, but when I hit errors I want as much info as possible (e.g., on headless servers where I can't even ssh so need maximal information in logs)</p>



<a name="212837373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837373">(Oct 09 2020 at 15:04)</a>:</h4>
<p>It's the reason I never use this language feature</p>



<a name="212837432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837432">(Oct 09 2020 at 15:05)</a>:</h4>
<p>I can't name one off the top of my head, but I think I've seen a few cases where Debug is opaque and so Display actually has <em>more</em> information.</p>



<a name="212837436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837436">(Oct 09 2020 at 15:05)</a>:</h4>
<p>I think anyhow actually works around this by forwarding Debug to Display, so I guess with that it would work</p>



<a name="212837489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837489">(Oct 09 2020 at 15:05)</a>:</h4>
<p>Importantly Debug is not meant for user-facing output, but for developer-facing output</p>



<a name="212837513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837513">(Oct 09 2020 at 15:05)</a>:</h4>
<p>Right, and it depends on the situation whether you are a developer seeing it or not</p>



<a name="212837565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837565">(Oct 09 2020 at 15:06)</a>:</h4>
<p>So if you write a CLI app that's supposed to be used by someone other than you, Display seems like the obvious choice</p>



<a name="212837569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837569">(Oct 09 2020 at 15:06)</a>:</h4>
<p>e.g. I don't really develop any applications with user-facing termination output</p>



<a name="212837770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212837770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212837770">(Oct 09 2020 at 15:07)</a>:</h4>
<p>I tried prototyping this on the playground and, uh, <a href="/user_uploads/4715/xgFSNqFaeYDQE8ek-66uT4B_/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/xgFSNqFaeYDQE8ek-66uT4B_/image.png" title="image.png"><img src="/user_uploads/4715/xgFSNqFaeYDQE8ek-66uT4B_/image.png"></a></div>



<a name="212838142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212838142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212838142">(Oct 09 2020 at 15:10)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=59e3a3e7336bbf0dc5e6d2601f709be2">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=59e3a3e7336bbf0dc5e6d2601f709be2</a> This works but requires the type to implement Debug whether it implements Display or not. I'm guessing this isn't much of a problem since <code>Error: Debug</code>, and you could also argue that this is a good thing since it means we aren't committing to a specialization-based API.</p>



<a name="212838874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212838874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212838874">(Oct 09 2020 at 15:15)</a>:</h4>
<p>Hm, I don't think this is allowed under the always applicable rules (though this could be worked around using <code>default impl</code> once that's implemented). I'm also not sure whether or not this is <em>unsound</em>, because I don't entirely understand those rules in the first place...</p>



<a name="212839146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212839146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212839146">(Oct 09 2020 at 15:17)</a>:</h4>
<p>Okay, I <em>think</em> this is sound because there aren't any associated types involved. I could be completely wrong on that though, and I feel like I might be missing something.</p>



<a name="212840318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212840318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212840318">(Oct 09 2020 at 15:26)</a>:</h4>
<p>Does anyone here have the knowledge on specialization needed for determining whether this is sound or not?</p>



<a name="212855151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212855151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212855151">(Oct 09 2020 at 17:38)</a>:</h4>
<p>(Without saying that Display actually would be better) The <code>Termination</code> usage comes from the frontend, so it would be <em>possible</em> to just make <code>Termination2</code> and switch the desugaring based on edition.</p>



<a name="212855468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212855468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212855468">(Oct 09 2020 at 17:41)</a>:</h4>
<p>that seems… ew.</p>



<a name="212855588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212855588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212855588">(Oct 09 2020 at 17:42)</a>:</h4>
<p>I'm much more partial to the ecosystem just deciding that Termination is not serving the purpose of being suitable for anything but toy programs and then people writing the glue that does what they need themselves when their codebases exceed whatever level of completeness at which they'd decide that it'd be worth their engineering time to do so.</p>



<a name="212855790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212855790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212855790">(Oct 09 2020 at 17:44)</a>:</h4>
<p>Termination seems exactly like a wrong thing for libstd to decide for general public to me. But its good enough as a convenient shortcut. And while it continues to be such a shortcut, whether it uses <code>Debug</code> or <code>Display</code> does not make much difference.</p>



<a name="212855800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212855800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212855800">(Oct 09 2020 at 17:44)</a>:</h4>
<p>I think that's what I'd prefer too.  It's not clear to me that "the one true <code>Termination</code>" can ever be good enough in <code>std</code>, so I'm fine to think of it as being more like an unwrap (thus debug) as an "unhandled error".</p>



<a name="212857355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212857355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212857355">(Oct 09 2020 at 17:59)</a>:</h4>
<p>Hm. I do feel like <code>main()</code> being allowed to return a <code>Result</code> is a very useful feature, though I agree that a unified <code>Termination</code> trait might not be the best way to go about doing that.</p>



<a name="212859316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212859316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212859316">(Oct 09 2020 at 18:18)</a>:</h4>
<p>This is a very hacky prototype, though it's at least an <em>idea</em> of what might work: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=ebbf690e309d3471de7ae2b947444841">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=ebbf690e309d3471de7ae2b947444841</a></p>



<a name="212859514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212859514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212859514">(Oct 09 2020 at 18:20)</a>:</h4>
<p>At the very least, I feel like this should be changed in some way. In my opinion, being able to have Termination use Display, no matter what mechanism leads to this, would instantly make it much more useful.</p>



<a name="212861123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212861123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212861123">(Oct 09 2020 at 18:35)</a>:</h4>
<p>I think the problem here isn't necessarily the <code>Termination</code> trait, but that right now <code>Termination</code> and <code>Try</code> are unstable, so people can't make their own.  If we could have crates explore things like <code>fn main() -&gt; MyCoolNewErrorReporting {</code> that interoperated with <code>?</code>, then people could just pick their reporting choices.</p>
<p>Of course, at that point it can also just be <code>main!</code> macros, so maybe that's not all that useful either...</p>



<a name="212861730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212861730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212861730">(Oct 09 2020 at 18:41)</a>:</h4>
<p>My prototype for a customizable Termination feels worse the more I think about it. While I do agree that Termination can't ever be one-size-fits-all, I do feel like changing it in the next edition to use Display would instantly increase its utility by quite a wide magnitude.</p>



<a name="212862037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212862037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212862037">(Oct 09 2020 at 18:44)</a>:</h4>
<p>It's currently useful for toy projects and servers with no form of error reporting other than logs. Changing it to Display would slightly hurt the server usecase, but would make it much more useful for CLI apps. I feel like CLI apps make up a much wider amount of use than that small subset of servers.</p>



<a name="212862075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212862075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212862075">(Oct 09 2020 at 18:45)</a>:</h4>
<p>I feel like this change shouldn't require an edition, but it's not possible with min_specialization, and it isn't easy to find a sound way to do that.</p>



<a name="212867870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212867870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212867870">(Oct 09 2020 at 19:46)</a>:</h4>
<p>One of the reasons that Termination (intentionally, TTBOMK) uses Debug is that some crates' Error types print source/context backtraces on Debug but not on Display.</p>



<a name="212868102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212868102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212868102">(Oct 09 2020 at 19:49)</a>:</h4>
<p>That isn't the behavior I'd expect from those crates. I'd expect Debug to give a literal description of the error value (something like <code>Error { code: 5, backtrace: [Frame, Frame, Frame]}</code>) while Display would give an error message to be displayed to a user (which would include a backtrace, possibly depending on something like RUST_LIB_BACKTRACE=1).</p>



<a name="212868222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212868222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212868222">(Oct 09 2020 at 19:50)</a>:</h4>
<p>Also, it seems straightforward to create a wrapper type whose Debug shows anything you like, including the Display impl.</p>



<a name="212868261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Termination%20and%20Display/near/212868261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Termination.20and.20Display.html#212868261">(Oct 09 2020 at 19:50)</a>:</h4>
<p>I did think of that, but at that point I don't really see a compelling benefit over a proc macro.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>